import imgSrc from '@/assets/common/img.jpeg';
import { Button, Popconfirm, Table } from 'antd';
import styles from './index.module.scss';

export default function UserManager() {
  return (
    <div className={styles.root}>
      <Table
        dataSource={[]}
        pagination={{}}
        columns={[
          {
            title: '姓名',
            dataIndex: 'username',
          },
          {
            title: '头像',
            dataIndex: 'staffPhoto',
            render(text) {
              return <img width={100} src={text || imgSrc} alt='用户头像' />;
            },
          },
          {
            title: '工号',
            dataIndex: 'workNumber',
          },
          {
            title: '手机号',
            dataIndex: 'mobile',
          },
          {
            title: '聘用形式',
            dataIndex: 'formOfEmployment',
          },
          {
            title: '部门',
            dataIndex: 'departmentName',
          },
          {
            title: '入职时间',
            dataIndex: 'timeOfEntry',
          },
          {
            title: '操作',
            dataIndex: 'action',
            render(_, rowData) {
              return (
                <>
                  <Popconfirm
                    title='确认删除该员工吗？'
                    onConfirm={() => console.log(rowData)}
                    okText='确定'
                    cancelText='取消'
                  >
                    <Button type='link'>删除</Button>
                  </Popconfirm>
                </>
              );
            },
          },
        ]}
        rowKey='id'
        bordered
        size='small'
      />
    </div>
  );
}
